package org.eking.bigdata.hadoop;

import java.io.IOException;
import java.util.Iterator;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

public class TestReduce extends Reducer<Text, IntWritable,Text, IntWritable>{

	public void reduce(Text InKey, Iterable<IntWritable> InValue, Context context)
			throws IOException {
		// 
		int MinValue = Integer.MAX_VALUE;
		for(IntWritable values:InValue){
			MinValue = Math.min(MinValue, values.get());		
		}
		try {
			context.write(InKey, new IntWritable(MinValue));
		} catch (InterruptedException e) {
			// 
			e.printStackTrace();
		}
	}

}
